package demo1;

public class Computer {
    public void powerOn() {
        System.out.println("电脑开机");
    }
    public void powerOff() {
        System.out.println("电脑关机");
    }
    public void usbService(IUSB iusb) {
        iusb.openDevice();
        if(iusb instanceof Mouse) {
            Mouse mouse = (Mouse) iusb;
            mouse.click();
        } else if (iusb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard) iusb;
            keyBoard.input();
        }


        iusb.closeDevice();
    }

}
